package com.tau.egonetwork.profiles;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

public class GroupsList<T extends Comparable<T>> extends ArrayList<Group<T>> {

	private static final long serialVersionUID = 7955466177540336119L;
	
	private Map<Integer, Group<T>> priorities;
		
	public void setPriority(int priority, Group<T> group) {
		
		if (priorities == null)
			priorities = new HashMap<Integer, Group<T>>();
		
		if (group == null) {
			priorities.remove(priority);
		} else {
			priorities.put(priority, group);
		}
	}
	
	public Group<T> getPriority(int priority) {

		if (priorities == null)
			priorities = new HashMap<Integer, Group<T>>();
		
		return priorities.get(priority);
	}

}
